cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(
    qlpmsp
    DESCRIPTION "qlpmsp"
    LANGUAGES C CXX
)

find_package(Qt5 REQUIRED COMPONENTS Core Widgets OpenGL Xml Sql Concurrent LinguistTools)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
  set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
  set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/lib)
  set(PLUGIN_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/extensions)
endif()

set(PLUGINS_PATH ${LIBRARY_OUTPUT_PATH}/plugins)
file(MAKE_DIRECTORY ${PLUGINS_PATH})

if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
  message(
    FATAL_ERROR
      "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
  )
endif()

add_subdirectory(code/core_system)
add_subdirectory(code/dev_base)
add_subdirectory(code/app_fwk)
